package com.qiusuo0226.platform.controller;


import com.qiusuo0226.common.util.EmojiTool;
import com.qiusuo0226.mvc.util.JsonResultModel;
import com.qiusuo0226.security.config.SecurityProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author qiusuo
 * @date 2023/2/23 21:51
 */
@Controller
@CrossOrigin
@Slf4j
@RequestMapping("/interface/test")
public class TestController {

    @Autowired
    private SecurityProperty securityProperty;

    @GetMapping({"/getTest"})
    @ResponseBody
    public JsonResultModel getTest() {
        JsonResultModel resultModel = JsonResultModel.success("demo OK", securityProperty);
        return resultModel;
    }

    @PostMapping({"/postTest"})
    @ResponseBody
    public JsonResultModel postTest(String str) {
        System.out.println(str);
        System.out.println(EmojiTool.containsEmoji(str));
        String s = EmojiTool.parseToAliases(str);
        System.out.println(s);
        str="\uD83E\uDD17\uD83D\uDE0F\uD83D\uDE36\uD83D\uDE10\uD83D\uDE44";
        JsonResultModel resultModel = JsonResultModel.success("demo OK",
                EmojiTool.parseToUnicode(str));
        return resultModel;
    }

}
